package com.chixing.day09_innerclass.order;

public class OrderProcessUtil {
    /*
        实现【通用】订单处理
    */
    public static Order[] process(Order order){//个人订单对象 Oeder order = new PersonOrder（）;
        int size = (int)(Math.ceil((double)order.getOrderNum()/1000));

        Order[] orders = new Order[size];
        int count = 0;
        //
        while (order.getOrderNum()>1000){
        Order subOrder = order.orderClone();//【通用】(1)new 订单对象 (2)属性 = 原始订单属性
        subOrder.setOrderNum(1000);
        order.setOrderNum(order.getOrderNum()-1000);
        orders[count++] = subOrder;
        }
        orders[count] = order;
        return orders;
    }
}
